home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 226 / 226.d81 / t.neural doc < prev    next >
Text File  |  2022-08-26  |  12KB  |  383 lines

  1. u
  2.    NEURAL NETWORK ON A COMMODORE 64
  3.             by John Walker
  4.           September 4, 1987
  5.  
  6.  
  7.        -----------------------
  8.  
  9.     When you first start to learn
  10. about computers, it's only natural to
  11. compare how a computer "thinks" with
  12. how people do. As you learn more, you
  13. tend to stop making such comparisons
  14. because you come to realize that far
  15. from the literal, dumb servants
  16. they're often pictured as in movies,
  17. computers are completely different
  18. from people both in how they operate
  19. and the kinds of problems they can
  20. solve.
  21.  
  22.     But it's still fascinating to
  23. compare a computer to a human brain.
  24. Researchers are beginning to discover
  25. principles which may explain how the
  26. brain works, and while much of this
  27. research is extremely complicated and
  28. requires large, expensive computers,
  29. your Commodore 64 can be programmed in
  30. BASIC to mimic one fundamental part of
  31. brain function, pattern recognition.
  32. In doing this, your computer is not
  33. only doing something the brain does
  34. (and your reaction may be "I didn't
  35. know a computer could do that!"), it's
  36. doing it the brain's way--by
  37. simulating the neurons (brain cells)
  38. with which you think.
  39.  
  40.  
  41. COMPUTER STORAGE AND HUMAN MEMORY
  42.  
  43.     First, let's compare what the word
  44. "memory" means in a computer as
  45. opposed to a human being. A computer
  46. memory is really a huge collection of
  47. pigeonholes into which numbers are
  48. stuffed. If you want to store
  49. something that isn't a number, such a
  50. piece of text, a picture, or a
  51. sequence of musical notes, you first
  52. have to convert it to numbers, then
  53. put those numbers into the pigeonholes
  54. of the computer's memory. Machine
  55. language programming is just
  56. translating the instructions for
  57. solving a problem into numbers the
  58. computer can remember. A computer
  59. stores numbers.
  60.  
  61.  
  62. ATTNEAVE'S CAT
  63.  
  64.     Human memory is richer and much
  65. more complicated. What comes to mind
  66. when you look at the picture in Figure
  67. 1? Even though this picture is nothing
  68. more than 63 straight black lines on a
  69. white piece of paper, your brain
  70. immediately recognizes it as a
  71. sleeping cat. You can even imagine how
  72. a real cat would look if seen from
  73. other angles. The human brain seems to
  74. store and recall patterns. These
  75. patterns don't have to be pictures.
  76. You can recall pieces of music from
  77. only a few notes of the melody, think
  78. of words that rhyme with "frog" or
  79. that end with "ple", and quickly name
  80. the American presidents that have the
  81. same names as automobiles.
  82.  
  83.     It isn't that human memory is
  84. better or worse than computer memory,
  85. but rather that they are entirely
  86. different things. Some computer
  87. scientists prefer the term "storage"
  88. to "memory" because it more accurately
  89. describes what the computer does. If
  90. you walk up to a computer and ask it
  91. "what is the name of the famous bridge
  92. in the same state as Disneyland" you
  93. won't have much success, but most
  94. people will immediately answer, "The
  95. Golden Gate Bridge". On the other
  96. hand, if you try to memorize a list of
  97. 20,000 two digit numbers, you probably
  98. won't succeed, yet a Commodore 64 can
  99. do this in less than a second and not
  100. make a single mistake. That computer
  101. and human memory are so different
  102. isn't all that surprising when you
  103. consider how differently constructed
  104. are the brain and a computer.
  105.  
  106.  
  107. WHAT BRAINS ARE MADE OF
  108.  
  109.     The portion of the brain believed
  110. responsible for thought and memory
  111. consists primarily of nerve cells, or
  112. neurons. (See Figure 2) Each neuron
  113. has three parts, dendrites, a cell
  114. body, and an axon. The dendrites
  115. connect to the axons of other neurons.
  116. When these other neurons are
  117. stimulated, the dendrites convey the
  118. signal to the cell body via a synapse
  119. or connection, which either excites or
  120. inhibits the neuron (with a different
  121. strength for each synapse). When the
  122. excitation sufficiently outweighs
  123. inhibition, the neuron "fires". This
  124. sends a signal down its axon which in
  125. turn excites or inhibits other
  126. neurons, and perhaps causes a muscle
  127. to move.
  128.  
  129.  
  130. A NEURON NETWORK
  131.  
  132.     Because neurons primarily connect
  133. to other neurons they form networks of
  134. great complexity. Figure 3 shows two
  135. fields of five neurons each, in which
  136. each neuron connects to every neuron
  137. in the other field. In this simple
  138. case we have 10 neurons with 5
  139. connections (or synapses) each, for a
  140. total of 50 synapses. Now consider the
  141. brain. Researchers believe that the
  142. brain contains between ten and a
  143. hundred billion neurons, each of which
  144. connects to anywhere from a thousand
  145. to a hundred thousand other neurons,
  146. forming at least ten trillion
  147. connections, and probably far more.
  148. Compare this to the read-write memory
  149. of the Commodore 64, which is made up
  150. of about a quarter million
  151. transistors, and remember that each
  152. transistor is only a switch--far
  153. simpler than a neuron.
  154.  
  155.  
  156. THE BRAIN SIMULATOR
  157.  
  158.     Ten billion neurons, ten trillion
  159. connections: does it make sense to
  160. talk about simulating the brain on a
  161. computer? Can we make a computer
  162. recognize patterns the way a brain
  163. does? Remarkably, we can. A simple
  164. program can simulate the behavior of a
  165. network of interconnected neurons. You
  166. can show this program patterns and it
  167. will remember them. Then if you show
  168. it a similar pattern, it will find the
  169. pattern it's learned that is most like
  170. the pattern it's shown. The technical
  171. name for this is an "associative
  172. memory", so called because it recalls
  173. items based on similarity, like the
  174. brain, as opposed to location, like a
  175. computer.
  176.  
  177.     The Brain Simulator is written in
  178. BASIC for the 64 and 128 (in 64 mode).
  179. You'll see two blank windows on the
  180. screen. Below them is a legend that
  181. explains the action of the function
  182. keys. When you type a letter or
  183. number, the dot pattern for that
  184. symbol appears in the left window.
  185.  
  186.     Try typing a few letters and
  187. numbers to see how this works. When
  188. you start the program, it doesn't know
  189. any patterns -- so we'll teach it
  190. some. To learn a pattern, place it in
  191. the left window by pressing the key
  192. for the letter or number and then
  193. press F1. The program trains its
  194. simulated neurons to memorize the
  195. pattern (this takes about 30 seconds).
  196. READY reappears on the screen when the
  197. pattern has been learned. Go ahead and
  198. teach the program three
  199. different-looking letters, "A", "T",
  200. and "Z".
  201.  
  202.     Now let's try recalling a pattern.
  203. Press the "A" key to place an A in the
  204. left window. Now press F3--this
  205. introduces errors in the pattern by
  206. randomly changing about 10% of the
  207. dots in the pattern each time you
  208. press it. After you press F3, you'll
  209. have a pattern that looks something
  210. like an A, but doesn't exactly match
  211. what we taught the program.
  212.  
  213.     Press F5 to start the recall
  214. process. The pattern is run back and
  215. forth through the neuron network until
  216. it stabilizes on a fixed pattern (an
  217. arrow in the middle of the screen
  218. shows the direction of the transfer).
  219. After the neuron network has "thought"
  220. about the problem for a few cycles,
  221. you'll probably get back the original
  222. A we taught the program (just like the
  223. brain, this process doesn't always
  224. remember the right thing; if the
  225. random changes made the pattern more
  226. like another pattern the program has
  227. learned, that one will be found
  228. instead).
  229.  
  230.     Try entering T and Z, creating
  231. errors in them by pressing F3 one or
  232. two times, and recalling with F5. Note
  233. how the neuron network almost always
  234. recalls the correct pattern even
  235. though you've given it something quite
  236. different from what it learned. Enter
  237. "I" and try recalling with F5. The
  238. network recognizes this as T because I
  239. looks more like T than A or Z, the
  240. other patterns it has learned. This is
  241. what your brain does when it sees a
  242. pattern of lines and immediately
  243. thinks of a sleeping cat. Many
  244. researchers think the basic process
  245. the brain uses is much the same as the
  246. one used by this program.
  247.  
  248.     You can make the program forget
  249. everything it has learned by pressing
  250. F4. If you press F6, the program exits
  251. to LOADSTAR. When you leave the
  252. program everything it has learned is
  253. forgotten, but you can save learned
  254. patterns on the disk by pressing F7
  255. and entering a file name. The next
  256. time you run the program you can
  257. reload the program's memory by
  258. pressing F8 and entering the same file
  259. name.
  260.  
  261.  
  262. HOW IT WORKS
  263.  
  264.     The remarkable thing about this
  265. program is that it doesn't "know" it's
  266. recognizing letters and numbers. As
  267. far a